It automatically maps HTTP request data to parameters in controller action methods.
What is Model Binding in ASP.NET Core?
253
20-May-2025
ICSM Computer
26-May-2025Model Binding in ASP.NET Core is the process that automatically maps incoming HTTP request data (from query strings, forms, route data, headers, or body) to action method parameters or model properties in controller actions.
Key Purpose
To reduce manual data parsing. Instead of reading request data explicitly (like from
Request.Form["name"]), ASP.NET Core binds the data directly to method parameters or objects.Example
If the request contains:
The
userparameter is automatically populated.Sources of Data for Model Binding
ASP.NET Core looks in the following places, in order:
[FromBody])[FromServices])You can explicitly specify a source using attributes:
[FromQuery][FromRoute][FromForm][FromBody][FromHeader][FromServices]Model Binding vs. Model Validation
[Required],[Range], etc.Summary